﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:simpleType name="projctmode_enum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="nm" />
      <xs:enumeration value="pm" />
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="inputtype_enum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Independent" />
      <xs:enumeration value="Dependent" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="objective_enum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Maximize" />
      <xs:enumeration value="Minimize" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="ImportanceFloat">
    <xs:restriction base="xs:float">
      <xs:minInclusive value="1"/>
      <xs:maxInclusive value="2"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="Project">   
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" name="SavedFiles">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="0" maxOccurs="unbounded" name="SavedFile">
                <xs:complexType>
                  <xs:attribute name="index" type="xs:unsignedShort" use="required" />
                  <xs:attribute name="sourcefilepath" type="xs:string" use="required" />
                  <xs:attribute name="relativedestinationpath" type="xs:string" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="AlgSettings">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="MaxTime">
                <xs:complexType>
                  <xs:attribute name="day" type="xs:unsignedShort" use="required" />
                  <xs:attribute name="hour" type="xs:unsignedByte" use="required" />
                  <xs:attribute name="min" type="xs:unsignedByte" use="required" />
                </xs:complexType>
              </xs:element>
              <xs:element name="MaxIter">
                <xs:complexType>
                  <xs:attribute name="count" type="xs:unsignedShort" use="required" />
                </xs:complexType>
              </xs:element>
              <xs:element name="AccuracyOfSolution">
                <xs:complexType>
                  <xs:attribute name="value" type="xs:double" use="required" />
                </xs:complexType>
              </xs:element>
              <xs:element name="AccuracyOfConstraintsObjective">
                <xs:complexType>
                  <xs:attribute name="value" type="xs:double" use="required" />
                </xs:complexType>
              </xs:element>
              <xs:element name="ParetoCount">
                <xs:complexType>
                  <xs:attribute name="value" type="xs:unsignedByte" use="required" />
                </xs:complexType>
              </xs:element>
              <xs:element name="CPUCount">
                <xs:complexType>
                  <xs:attribute name="value" type="xs:unsignedByte" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="ProjectInputParameters">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="ProjectInputParameter">
                <xs:complexType>
                  <xs:attribute name="index" type="xs:unsignedShort" use="required" />
                  <xs:attribute name="name" type="xs:string" use="required" />
                  <xs:attribute name="type" type="inputtype_enum" use="required" />
                  <xs:attribute name="lowerbound" type="xs:double" use="optional" />
                  <xs:attribute name="upperbound" type="xs:double" use="optional" />
                  <xs:attribute name="value" type="xs:double" use="optional" />
				  <xs:attribute name="enum" type="xs:string" use="optional" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="ProjectOutputParameters">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="ProjectOutputParameter">
                <xs:complexType>
                  <xs:attribute name="index" type="xs:unsignedShort" use="required" />
                  <xs:attribute name="name" type="xs:string" use="required" />
                  <xs:attribute name="objective" type="objective_enum" use="optional" />
                  <xs:attribute name="importance" type="ImportanceFloat" use="optional" />
                  <xs:attribute name="lowerbound" type="xs:double" use="optional" />
                  <xs:attribute name="upperbound" type="xs:double" use="optional" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" name="InitialPoints">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="InitialPoint">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="InputParameters">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element maxOccurs="unbounded" name="InputParameter">
                            <xs:complexType>
                              <xs:attribute name="index" type="xs:unsignedShort" use="required" />
                              <xs:attribute name="value" type="xs:double" use="required" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element minOccurs="0" name="OutputParameters" >
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element maxOccurs="unbounded" name="OutputParameter">
                            <xs:complexType>
                              <xs:attribute name="index" type="xs:unsignedShort" use="required" />
                              <xs:attribute name="value" type="xs:double" use="required" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="index" type="xs:nonNegativeInteger" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="name" type="xs:string" use="required" />
      <xs:attribute name="workpath" type="xs:string" use="required" />
      <xs:attribute name="filename" type="xs:string" use="required" />
      <xs:attribute name="mode" type="projctmode_enum" use="required" />
      <xs:attribute name="version" type="xs:unsignedByte" use="required" />
      <xs:attribute name="desc" type="xs:string" use="required" />
      <xs:attribute name="integr_proj_path" type="xs:string" use="optional" />
      <xs:attribute name="integrator" type="xs:string" use="optional" />
      <xs:attribute name="adaptive" type="xs:boolean" use="optional" />
    </xs:complexType>
  </xs:element>
</xs:schema>